<template>
    <div id="nav">
        <router-link class="bg" target="_blank" active-class="active" to="/">首页</router-link>
        |
        <router-link class="bg" to="/about">关于</router-link>
        |
        <router-link class="bg" to="/user">个人中心</router-link>
        |
        <router-link to="/about" custom v-slot="{navigate}">
            <button @click="navigate" @keypress.enter="navigate" role="link">aaaaa</button>
        </router-link>
        |
        <button :class="{active:$route.path=='/user'}" @click="$router.push('/user')">ggggg</button>
        |
        <button @click="$router.go(-1)">bbbbb</button>
        |
        {{$route.path}}
    </div>
    <hr width="100%">
    <!--一个链接可以加载多个组件-->
    <router-view class="one" name="User"></router-view>
    <router-view class="two"></router-view>
    <router-view class="three" name="About"></router-view>
</template>

<script>
    export default {
        name: 'App',
    }
</script>

<style scoped lang="scss">
    #app {
        font-family: Avenir, Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-align: center;
        color: #2c3e50;
    }

    #nav {
        padding: 30px;
    }

    #nav a {
        font-weight: bold;
        color: #2c3e50;
    }

    #nav a.router-link-exact-active {
        color: blueviolet;
    }

    .bg {
        background-color: yellow;
    }

    .active {
        color: blueviolet;
    }

    .one {
        width: 30%;
        height: 100px;
        background-color: #888888;
        float: left;
    }

    .two {
        width: 50%;
        height: 100px;
        background-color: blueviolet;
        float: left;
    }

    .three {
        width: 20%;
        height: 100px;
        background-color: greenyellow;
        float: right;
    }
</style>
